//
// Created by lester on 2023/12/22.
//

#ifndef TEST_GETTHREADID_H
#define TEST_GETTHREADID_H
thread_local int32_t t_cachedTid;
#include <sys/syscall.h>
namespace util{
    int  GetThreadId(){
        if(t_cachedTid == 0){
            t_cachedTid =  static_cast<pid_t>(::syscall(SYS_gettid));
        }
        return t_cachedTid;
    }
}

#endif //TEST_GETTHREADID_H
